<script setup lang='ts'>
  import { onMounted, reactive } from 'vue';
  import { lassoCattleApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import { getPlayEndTime, getDateArray } from '@/utils'
  const action = reactive({
    list:[] as any[],
    poolList:[] as any[],
    dateArr:getDateArray('ymdhis') as Array<number>
  })
  const getList = async()=> {
    const loading = Toastloading()
    const timeObi = getPlayEndTime(action.dateArr)
    const res = await lassoCattleApi.statSearchAll({
      date_st:timeObi.playTime,
      date_ed:timeObi.endTime
    })
    loading.close()
    const { data={} } = res || {}
    action.list = [data]
    action.poolList = data?.poolList || []
  }
  onMounted(()=>{
    getList()
  })
</script>

<template>
  <div class="xm-content">
    <div class="labelBox">
      <div class="labelItem">
        <div class="label">时间：</div>
        <el-date-picker
          v-model="action.dateArr"
          type="datetimerange"
          format="YYYY-MM-DD HH:mm:ss "
          value-format="YYYY-MM-DD HH:mm:ss"
          range-separator="至"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
        />
      </div>
      <div class="labelItem">
        <el-button type="primary" @click="getList">查询</el-button>
      </div>
    </div>
    <el-table
      class="xm-TableCenter"
      :data="action.list"
      border>
      <el-table-column min-width="120" prop="userNum" label="参与人数" />
      <el-table-column min-width="120" prop="stakeNumAll" label="参与次数" />
      <el-table-column min-width="120" prop="stakeNum" label="成功次数" />
      <el-table-column min-width="120" prop="stakePriceAll" label="消耗金豆数量" />
      <el-table-column min-width="120" prop="rewardPriceAll" label="产出金豆数量" />
      <el-table-column min-width="120" prop="porfitNum" label="平台费率(金豆)" />
      <el-table-column min-width="120" prop="porfitNum2" label="利润数量(金豆)" />
      <el-table-column min-width="120" prop="porfitRate" label="利润率"/>
      <el-table-column min-width="120" prop="returnRate" label="回馈率" />
    </el-table>
    <el-table
      class="xm-TableCenter"
      style="margin-top:40px;"
      :data="action.poolList"
      border>
      <el-table-column min-width="120" prop="poolId" label="牛ID" />
      <el-table-column min-width="120" prop="name" label="牛名称" />
      <el-table-column min-width="120" prop="stakeNumAll" label="参与次数" />
      <el-table-column min-width="120" prop="stakePriceAll" label="消耗金豆数量" />
      <el-table-column min-width="120" prop="rewardPriceAll" label="产出金豆数量" />
      <el-table-column min-width="120" prop="returnRate" label="回馈率" />
    </el-table>
  </div>
</template>
